package com.shop.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.shop.core.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 * 分类表
 * </p>
 *
 * @author lpx610
 * @since 2023-11-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class PmsCategory extends BaseEntity {

    private static final long serialVersionUID = 1L;

    public PmsCategory(String id) {
        super(id);
    }

    public PmsCategory(String name, String parentId, Integer level) {
        this.name = name;
        this.parentId = parentId;
        this.level = level;
    }

    /**
     * 分类名称
     */
    private String name;

    /**
     * 上级id
     */
    private String parentId;

    /**
     * 当前层级
     */
    private Integer level;

    /**
     * 状态
     */
    private Boolean active;

    /**
     * 排序
     */
    private Long sort;

    /**
     * 子集
     */
    @TableField(exist = false)
    private List<PmsCategory> children;
}
